From 11132c0edb1d2ac8cf23d17f580be04adf2c4aca Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 16 Sep 2008 21:14:25 +0000 Subject: [PATCH] * (bug 10463) Apply $wgRenderHashAppend to sitenotice cache keys so SSL and non-SSL sites get separate notice caches. This seems to be a little funny, though, at least on commons -- the commonswiki:sitenotice:https=1 key is just storing 'false' so it presumably gets reparsed on each run. I can't see any way that this should be happening, which is a little intimidating... --- includes/GlobalFunctions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e6aca47ee6..44d35120da 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1741,7 +1741,7 @@ function swap( &$x, &$y ) { } function wfGetCachedNotice( $name ) { - global $wgOut, $parserMemc; + global $wgOut, $wgRenderHashAppend, $parserMemc; $fname = 'wfGetCachedNotice'; wfProfileIn( $fname ); @@ -1763,7 +1763,9 @@ function wfGetCachedNotice( $name ) { } } - $cachedNotice = $parserMemc->get( wfMemcKey( $name ) ); + // Use the extra hash appender to let eg SSL variants separately cache. + $key = wfMemcKey( $name . $wgRenderHashAppend ); + $cachedNotice = $parserMemc->get( $key ); if( is_array( $cachedNotice ) ) { if( md5( $notice ) == $cachedNotice['hash'] ) { $notice = $cachedNotice['html']; @@ -1777,7 +1779,7 @@ function wfGetCachedNotice( $name ) { if( $needParse ) { if( is_object( $wgOut ) ) { $parsed = $wgOut->parse( $notice ); - $parserMemc->set( wfMemcKey( $name ), array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 ); + $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 ); $notice = $parsed; } else { wfDebug( 'wfGetCachedNotice called for ' . $name . ' with no $wgOut available' ); -- 2.20.1